﻿<!DOCTYPE html>
<!--班长审批-->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <link href="/static/js/vue-treeselect/vue-treeselect.css" rel="stylesheet" />
    <script src="/static/js/vue-treeselect/vue-treeselect.js"></script>
    <style>
        /*说明：
         由于mystyle.css中162行.el-form-item__content {line-height: normal!important;}导致的
         index.css中.el-form-item--mini .el-form-item__content, .el-form-item--mini .el-form-item__label{    line-height: 28px;}失效
         但出于无法修改样式表的情况，所以在该页面添加以下样式，以保证页面内标题和内容不偏离
        */
        .el-form-item--mini .el-form-item__content,
        .el-form-item--mini .el-form-item__label {
            line-height: 28px !important;
        }

        el-dialog.is-fullscreen {
            overflow: hidden !important;
        }
    </style>
    <style>
        ._delete-icon {
            position: absolute;
            right: 5px;
            bottom: 13px;
            cursor: pointer;
            display: none;
        }
    </style>
    <style>
        .vue-treeselect__control {
            height: 100%;
            border: none;
            background: none;
        }

        .vue-treeselect__placeholder {
            top: -3px;
        }

        .vue-treeselect__single-value {
            top: -3px;
        }

        .el-input__suffix {
            /* z-index: 9; */
        }
    </style>
</head>

<body>
    <div id="app" v-cloak class="popupW100">
        <el-form :model="Form" status-icon :rules="rules" ref="ruleForm" size="mini" label-position="right">
            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item :label="RisksManagement.MonitorApproval.Discoverer+mark.m"
                                class="inputTextarea">
                                {{Form.Discoverer}}
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
                <el-col :span="11" offset="2">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item :label="RisksManagement.MonitorApproval.OrganizationType+mark.m"
                                class="inputTextarea">
                                {{Form.OrganizationType}}
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>

            </el-row>
            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item :label="RisksManagement.MonitorApproval.DiscoveryTime+mark.m"
                                class="inputTextarea">
                                {{Form.DiscoveryTime}}
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
                <el-col :span="11" offset="2">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item :label="RisksManagement.MonitorApproval.InspectType+mark.m"
                                class="inputTextarea">
                                {{Form.InspectType}}
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>

            </el-row>
            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item :label="RisksManagement.MonitorApproval.RiskType+mark.m"
                                class="inputTextarea">
                                {{Form.RiskType}}
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
                <el-col :span="7" offset="2">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{RisksManagement.MonitorApproval.RiskLevel+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" v-model="Form.RiskLevel" slot="suffix"
                                        :placeholder="RisksManagement.MonitorApproval.RiskLevel">
                                        <el-option label="请选择" value=""></el-option>
                                        <el-option v-for="item in RiskLevel" :label="item.value" :value="item.key">
                                        </el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>
                <el-col :span="3" offset="1">
                    <el-link :underline="false" @click="OpenMajorRiskDossier" type="primary"
                        style="font-size: 14px;color:#409eff;cursor:pointer;">
                        {{RisksManagement.MajorRiskDossier.MajorRiskDossier}}</el-link>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="11">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input size="mini">
                                <template slot="prepend">
                                    {{RisksManagement.MonitorApproval.AppointPerson+mark.m}}
                                </template>
                                <treeselect v-model="Form.AppointPerson" :options="AppointPerson" :flat="true"
                                    :show-count="true" :disable-branch-nodes="true" slot="suffix"
                                    style="line-height: 28px;width:70%;float: right;" placeholder="请选择" />
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">
                    <el-form-item :label="RisksManagement.MonitorApproval.RiskDescription+mark.m" class="inputTextarea">
                        {{Form.RiskDescription}}
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="24">

                    <el-form-item :label="RisksManagement.MonitorApproval.BeforeRectificationImg+mark.m"
                        prop="BeforeRectificationImg" class="inputTextarea" style="position:relative;">
                        <div v-for="src in Form.BeforeRectificationImg"
                            style="float:left;margin-right:5px;position:relative;" class="ImgBox">
                            <i class="el-icon-delete _delete-icon" @click="deleteImg(src.id)"></i>
                            <el-image :src="src.Img" fit="fill" width="200" height="100">
                            </el-image>
                        </div>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>


                    <el-col :span="24">
                            <div class="elst-select-mini">
                                <el-form-item>
                                    <div class="el-input--mini el-input-group">
                                        <div class="el-input-group__prepend">
                                            {{RisksManagement.MonitorApproval.ApprovalOpinion+mark.m}}
                                        </div>
                                        <el-input class="el-textarea__inner" type="textarea" v-model="Form.ApprovalOpinion"
                                            autocomplete="off"></el-input>
                                    </div>
                                </el-form-item>
                            </div>
                        </el-col>


            </el-row>
            <el-row>
                <el-col :span="11">
                    <el-col>
                        <div class="elst-select-mini">
                            <el-form-item>
                                <el-input size="mini">
                                    <template slot="prepend">
                                        <div> {{RisksManagement.MonitorApproval.ApprovalResult+mark.m}}</div>
                                    </template>
                                    <el-select @visible-change="visibleChange" v-model="Form.ApprovalResult" slot="suffix"
                                        :placeholder="RisksManagement.MonitorApproval.ApprovalResult">
                                        <el-option label="请选择" value=""></el-option>
                                        <el-option v-for="item in ApprovalResult" :label="item.value" :value="item.key">
                                        </el-option>
                                    </el-select>
                                </el-input>
                            </el-form-item>
                        </div>
                    </el-col>
                </el-col>

            </el-row>
            <el-row type="flex" justify="end">
                <el-form-item>
                    <el-button type="primary" @click="onSubmitForm('ruleForm')">{{col.btnApprova}}</el-button>
                    <el-button type="primary" @click="parent.ListItem.dialogVisible=false">{{col.btnBack}}</el-button>
                </el-form-item>
            </el-row>
        </el-form>
        <el-dialog fullscreen="true" :title="RisksManagement.MajorRiskDossier.MajorRiskDossier"
            :visible.sync="ListItem.dialogVisible" width="80%" height="80%" top="10vh">
            <iframe ref="iframe" :src="ListItem.InputUrl" style="height:95%;width:100%" frameborder="0"></iframe>
        </el-dialog>
    </div>

    <script type="text/javascript">

        app = new Vue({
            el: '#app',
            data: {
                //父业传参
                id: '',
                //mydata: myTree,
                mydata: PersonInChargeTree,
                ListItem: ListItem,
                //业务表单内容
                Form: {
                    id: guidEmpty,
                    Discoverer: '',
                    OrganizationType: '',
                    InspectType: '',
                    DiscoveryTime: '',
                    RiskType: '',
                    RiskLevel: '',
                    AppointPerson: null,
                    RiskDescription: '',
                    BeforeRectificationImg: [],
                    ApprovalResult: '',//审批结果
                },
                OrganizationType: [],
                InspectType: [],
                AppointPerson: [],
                RiskType: [],
                RiskLevel: [],
                ApprovalResult: [],
                //表单验证
                rules: {

                }
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },

                //重大隐患项目档案
                OpenMajorRiskDossier: function () {
                    var id = '123';
                    this.ListItem.InputUrl = "../MajorRisk/MajorRiskDossierInput.html?type=ck&id=" + id + "&t=" + Date.parse(new Date());
                    this.ListItem.dialogVisible = true;
                },
                //上传状态改变事件，随便选个可触发的钩子模拟上传
                UploadChange: function (file, filelist) {
                    if (file.status == 'ready') {

                        this.Form.BeforeRectificationImg.push({
                            id: Mock.Random.id(),
                            Img: Mock.Random.image('200x100', '#1989fa', '#FFFFFF', 'Test Image' + ($(".ImgBox").length + 1)),
                        });
                    }
                    else if (file.status == 'fail') {

                    }
                },
                //提交数据
                onSubmitForm: function (formName) {
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                        //验证通过
                        if (valid) {
                            onSubmitForm(this, '/api/MonitorApproval/Save', mythis.Form);
                        } else {
                            //验证失败
                            return false;
                        }
                    });

                },
                getData: function () {
                    getData(this, '/api/MonitorApproval/get?id=' + this.id);
                },

            },
            mounted: function () {
                this.RiskLevel = getDicData('03');
                this.RiskType = getDicData('100');
                this.OrganizationType = getDicData('103');
                this.InspectType = getDicData('101');
                this.AppointPerson = fn(this.mydata, "0");
                this.ApprovalResult = getDicData('130');
                this.id = getUrlParam("id");
                this.getData();
                this.Form.OrganizationType = getDicValue("103", this.Form.OrganizationType)
                this.Form.RiskType = getDicValue("100", this.Form.RiskType)
                this.Form.InspectType = getDicValue("101", this.Form.InspectType)
                if (!this.id) {
                    this.Form.Discoverer = Mock.Random.cname();
                }
            }
        });
    </script>
</body>

</html>